import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
// import { rules } from '/@/utils/helper/validator';
// import { render } from '/@/utils/common/renderUtils';
// import { propTypes } from "@/utils/propTypes";
// import { JInputTypeEnum } from "@/enums/jeecgEnum";
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '合同号',
    align: "center",
    dataIndex: 'contractNo'
  },
  {
    title: '包装通知单',
    align: "center",
    dataIndex: 'packageNo'
  },
  {
    title: '发票抬头编号',
    align: "center",
    dataIndex: 'invoiceTitleId'
  },
  {
    title: '出口国家',
    align: "center",
    dataIndex: 'exportCountry'
  },
  {
    title: '出口编号',
    align: "center",
    dataIndex: 'exportNo'
  },
  {
    title: '操作人',
    align: "center",
    dataIndex: 'dealUsername'
  },
  {
    title: '匹配状态',
    align: "center",
    dataIndex: 'matchFlag_dictText'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "合同号",
    field: 'contractNo',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: "包装通知单",
    field: 'packageNo',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: "出口国家",
    field: "exportCountry",
    component: 'Input', //TODO 范围查询
    colProps: { span: 6 },
  },
  {
    label: "出口编号",
    field: 'exportNo',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: "操作人",
    field: "dealUsername",
    component: 'Input', //TODO 范围查询
    colProps: { span: 6 },
  },
  {
    label: "匹配状态",
    field: 'matchFlag',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "match_flag"
    },
    colProps: { span: 6 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '发票抬头编号',
    field: 'invoiceTitleId',
    component: 'Input',
    dynamicRules: () => {
      return [
        { required: true, message: '请输入发票抬头编号!' },
      ];
    },
  },
  {
    label: '合同号',
    field: 'contractNo',
    component: 'Input',
    dynamicRules: () => {
      return [
        { required: true, message: '请输入合同号!' },
      ];
    },
  },
  {
    label: '包装通知单',
    field: 'packageNo',
    component: 'Input',
  },
  {
    label: '出口国家',
    field: 'exportCountry',
    component: 'Input',
  },
  {
    label: '出口编号',
    field: 'exportNo',
    component: 'Input',
  },
  {
    label: '操作人',
    field: 'dealUsername',
    component: 'Input',
  },
  {
    label: '匹配状态',
    field: 'matchFlag',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "match_flag"
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

//发票抬头表单数据
export const formInvoiceTitle: FormSchema[] = [
  {
    label: '销货单位',
    field: 'saleCompany',
    component: 'Input',
  },
  {
    label: '地址',
    field: 'saleAddr',
    component: 'Input',
  },
  {
    label: '税号',
    field: 'saleTaxNo',
    component: 'Input',
  },
  {
    label: '开户银行',
    field: 'saleBank',
    component: 'Input',
  },
  {
    label: '账号',
    field: 'saleBankCard',
    component: 'Input',
  },
  {
    label: '购货单位',
    field: 'buyCompany',
    component: 'Input',
  },
  {
    label: '地址',
    field: 'buyAddr',
    component: 'Input',
  },
  {
    label: '税号',
    field: 'buyTaxNo',
    component: 'Input',
  },
  {
    label: '开户银行',
    field: 'buyBank',
    component: 'Input',
  },
  {
    label: '账号',
    field: 'buyBankCard',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  console.log('_formData :>>', _formData);
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
